package com.sz.biz.logistics.ord.service;

import com.sz.biz.logistics.billing.dto.OrderCalcResult;
import com.sz.biz.logistics.ord.entity.OrdOrder;
import com.sz.biz.logistics.ord.entity.OrdOrderAddress;
import com.sz.biz.logistics.ord.entity.OrdServiceBill;
import com.sz.biz.logistics.ord.entity.OrderCalcJob;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * Function: OrderCalcJobService <br>
 * Author: wentao.chang <br>
 * Date: 2017-05-18 18:46:00
 */

public interface OrderCalcJobService {

    /**
     * 计算所有未计费订单
     *
     * @param type 1采购价 2销售价
     */
    void calcCron(int type) throws ExecutionException, InterruptedException;

    /**
     * 计算所有未计汇率订单
     */
    void calcExchangeRateCron() throws ExecutionException, InterruptedException;

    /**
     * 按订单号获取已有的计费历史
     */
    List<OrderCalcJob> findByOrderNo(String orderNo);

    /**
     * 按订单号以及费用类型获取已有的计费历史
     */
    List<OrderCalcJob> findByOrderNoAndType(String orderNo, int feeType);

    /**
     * 插入计费信息
     *
     * @param job job
     */
    void insert(OrderCalcJob job);

    /**
     * 按订单详情计费
     *
     * @param ordOrder     ordOrder
     * @param orderAddress orderAddress
     * @param calcType     1定时任务 2.手工点击
     * @param type         1采购价 2销售价
     */
    OrderCalcResult calcOrdOrder(OrdOrder ordOrder, OrdOrderAddress orderAddress, int calcType, int type);

    /**
     * 按订单计费
     *
     * @param orderNo orderNo
     * @param type    1采购价 2销售价
     */
    OrderCalcResult calcOrdOrder(String orderNo, int type);


    void calcOrdOrderExchange(OrdServiceBill bill);

}
